package com.stage.communication.oneOnone;


import com.stage.helper.InputManager;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

/**
 * Created by Stage on 2017/3/24.
 */
public class OneOnOneClient {
    public static void main(String[] args) {
        InputManager inputManager = new InputManager();
        try {
            Socket socket = new Socket("127.0.0.1", 888);
            InputStreamReader reader = new InputStreamReader(socket.getInputStream());
            BufferedReader bufferedReader = new BufferedReader(reader);
            PrintWriter writer = new PrintWriter(socket.getOutputStream());
            String readLine = inputManager.inputString("请输入您想对客服说的话");
            writer.println(readLine);
            writer.flush();
            String response = bufferedReader.readLine();
            System.out.println("Server say:   " + response);
            writer.close();
            bufferedReader.close();
            socket.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
